fix: holding left click breaks mask#959
Conversation
|
@claytonlin1110 is attempting to deploy a commit to the React Component Team on Vercel. A member of the Team first needs to authorize it. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
Walkthrough在 Input.tsx 中引入对 mousedown 聚焦路径的跟踪与保护:在鼠标按下来源的聚焦下,延后粘贴/按键格式化与选择同步至 mouseup;调整 useLayoutEffect 的守卫逻辑并新增测试覆盖该行为。 Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@afc163 Please review |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 此拉取请求旨在解决 Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #959 +/- ##
=======================================
Coverage 98.80% 98.81%
=======================================
Files 65 65
Lines 2685 2691 +6
Branches 720 742 +22
=======================================
+ Hits 2653 2659 +6
Misses 29 29
Partials 3 3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tests/new-range.spec.tsx`:
- Around line 1013-1024: The test "focus by mousedown defers selection sync to
mouseUp" only asserts selectionStart/End are defined after mouseUp, which is too
weak; update the test around Demo/startInput to assert selectionStart and
selectionEnd are null (or unchanged) immediately after fireEvent.mouseDown and
fireEvent.focus to prove selection is not synchronized yet, then assert they
become numeric (not null/undefined) after fireEvent.mouseUp; reference the
existing calls fireEvent.mouseDown(startInput), fireEvent.focus(startInput),
fireEvent.mouseUp(startInput) and the selectionStart/selectionEnd checks when
adding these pre- and post-mouseUp assertions.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 846d82a8-8256-470e-9d54-993f53cca631
📒 Files selected for processing (1)
tests/new-range.spec.tsx
|
@zombieJ Please review when you have a chance. Thanks. |
|
@zombieJ Updated. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/PickerInput/Selector/Input.tsx`:
- Around line 100-101: mouseDownRef currently only resets to false inside
onFormatMouseUp, which can leave it stuck true if the user releases the mouse
outside the input or the window loses focus; add global listeners to ensure it's
always cleared: register a window (or document) 'mouseup' and 'blur' handler
that sets mouseDownRef.current = false and invoke the same cleanup used by
onFormatMouseUp, remove those listeners in the component cleanup/unmount, and
ensure onFormatPaste and onFormatKeyDown behavior resumes correctly; also add a
unit/integration test simulating mouse-down then mouse-up outside the input (and
blur) to assert mouseDownRef is cleared and selection/format handlers aren't
blocked.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 5e90cb6c-a9f6-4b01-a37e-51d85a841450
📒 Files selected for processing (1)
src/PickerInput/Selector/Input.tsx
src/PickerInput/Selector/Input.tsx
Outdated
| } | ||
|
|
||
| // Reset with format if not match | ||
| // Reset with format if not match (always apply when focused so mask works when focusing by mousedown) |
There was a problem hiding this comment.
这里和下面没有还原呀…………
你在 github 的 diff view 可以看的:
另外,CI 还是失败的哈~
https://github.com/react-component/picker/actions/runs/22935988370/job/66567899243?pr=959
There was a problem hiding this comment.
Just updated, please re-run CI

Closes issue
Summary by CodeRabbit
发布说明
Bug修复
测试